# @Author: Minyan Lu
# @Email:  lminyan@outlook.com
# @Timestamp for Creation: 2021-05-31 16:35:22
# @Last Modified by:   Minyan Lu
# @Last Modified time: 2022-10-14 21:37:26


# FOXP3 rs3761548 A C

# Dominant model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Fig/dominant model")
Dom<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Table/rs3761548_dom_2.0.csv",header=TRUE,dec=".")

event.e<-Dom$AC_CC_case
n.e<-Dom$AC_CC_case+Dom$AA_case
event.c<-Dom$AC_CC_control
n.c<-Dom$AC_CC_control+Dom$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Dom,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Dom$Author,Dom$Year))

YourFileName<-paste("Dominant model forest_2.0.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()





# Heterozygote model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Fig/heterozygote model")
Het<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Table/rs3761548_het_2.0.csv",header=TRUE,dec=".")

event.e<-Het$AC_case
n.e<-Het$AC_case+Het$AA_case
event.c<-Het$AC_control
n.c<-Het$AC_control+Het$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Het,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Het$Author,Het$Year))

YourFileName<-paste("Heterozygote model forest_2.0.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()





# Homozygote model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Fig/homozygote model")
Hom<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Table/rs3761548_hom_2.0.csv",header=TRUE,dec=".")

event.e<-Hom$CC_case
n.e<-Hom$CC_case+Hom$AA_case
event.c<-Hom$CC_control
n.c<-Hom$CC_control+Hom$AA_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Hom,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Hom$Author,Hom$Year))

YourFileName<-paste("Homozygote model forest_2.0.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()





# Recessive model forest

library("meta")

setwd("/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Fig/recessive model")
Rec<-read.csv(file="/Users/hush/Documents/Project/Xiaoqin_Yang/FOXP3/3_Statistical_Analysis/rs3761548/Table/rs3761548_rec_2.0.csv",header=TRUE,dec=".")

event.e<-Rec$CC_case
n.e<-Rec$CC_case+Rec$AA_AC_case
event.c<-Rec$CC_control
n.c<-Rec$CC_control+Rec$AA_AC_control

meta1<-metabin(event.e,n.e,event.c,n.c,data=Rec,
	method="MH",sm="OR",
	comb.fixed=TRUE,comb.random=TRUE,
	studlab=paste(Rec$Author,Rec$Year))

YourFileName<-paste("Recessive model forest_2.0.PDF")
pdf(file=YourFileName,height=4.5,width=10)

forest(meta1,lab.e="PE",lab.c="Control")

dev.off()
